American employers were optimistic enough in economic prospects to hire an unexpectedly large number of workers in July.